# -----------------------------------------------------------------
# $Revision: 1.12.2.2 $
# $Date: 2005/02/14 23:15:26 $
# -----------------------------------------------------------------
# Programmer(s): Radu Serban and Aaron Collier @ LLNL
# -----------------------------------------------------------------
# Copyright (c) 2002, The Regents of the University of California.
# Produced at the Lawrence Livermore National Laboratory.
# All rights reserved.
# For details, see sundials/shared/LICENSE.
# -----------------------------------------------------------------
# Makefile for serial NVECTOR module
#
# @configure_input@
# -----------------------------------------------------------------

SHELL = @SHELL@

srcdir       = @srcdir@
builddir     = @builddir@
abs_builddir = @abs_builddir@
top_builddir = @top_builddir@
prefix       = @prefix@
exec_prefix  = @exec_prefix@
includedir   = @includedir@
libdir       = @libdir@

INSTALL        = @INSTALL@
INSTALL_LIB    = @INSTALL_PROGRAM@
INSTALL_HEADER = @INSTALL_DATA@

LIBTOOL      = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@

CPP      = @CPP@
CPPFLAGS = @CPPFLAGS@
CC       = @CC@
CFLAGS   = @CFLAGS@
LIBS     = @LIBS@

FCMIX_ENABLED = @FCMIX_ENABLED@

SHARED_INC_DIR         = $(srcdir)/../shared/include
NVECTOR_SERIAL_INC_DIR = $(srcdir)

NVECTOR_SERIAL_LIB       = libsundials_nvecserial.la
NVECTOR_SERIAL_LIB_FILES = nvector_serial.lo

FNVECTOR_SERIAL_LIB       = libsundials_fnvecserial.la
FNVECTOR_SERIAL_LIB_FILES = fnvector_serial.lo

all: update $(NVECTOR_SERIAL_LIB_FILES) $(FNVECTOR_SERIAL_LIB_FILES)

update:
	${INSTALL_HEADER} ${top_builddir}/config/sundials_config.h ${builddir}

install: update $(NVECTOR_SERIAL_LIB_FILES) $(FNVECTOR_SERIAL_LIB_FILES)
	$(LIBTOOL) --mode=link $(CC) $(CFLAGS) -o $(NVECTOR_SERIAL_LIB) $(NVECTOR_SERIAL_LIB_FILES) -rpath $(libdir) $(LIBS) -avoid-version
	$(LIBTOOL) --mode=install $(INSTALL_LIB) $(NVECTOR_SERIAL_LIB) $(libdir)
	$(INSTALL_HEADER) $(NVECTOR_SERIAL_INC_DIR)/nvector_serial.h $(includedir)
	@if test "X${FCMIX_ENABLED}" = "Xyes"; then                                                                                                               \
	   echo "${LIBTOOL} --mode=link ${CC} ${CFLAGS} -o ${FNVECTOR_SERIAL_LIB} ${FNVECTOR_SERIAL_LIB_FILES} -rpath ${libdir} ${LIBS} -static -avoid-version" ; \
	   ${LIBTOOL} --mode=link ${CC} ${CFLAGS} -o ${FNVECTOR_SERIAL_LIB} ${FNVECTOR_SERIAL_LIB_FILES} -rpath ${libdir} ${LIBS} -static -avoid-version ;        \
	   echo "${LIBTOOL} --mode=install ${INSTALL_LIB} ${FNVECTOR_SERIAL_LIB} ${libdir}" ;                                                                     \
	   ${LIBTOOL} --mode=install ${INSTALL_LIB} ${FNVECTOR_SERIAL_LIB} ${libdir} ;                                                                            \
	 fi

clean:
	$(LIBTOOL) --mode=clean rm -f $(NVECTOR_SERIAL_LIB)
	rm -f $(NVECTOR_SERIAL_LIB_FILES)
	rm -f nvector_serial.o
	@if test "X${FCMIX_ENABLED}" = "Xyes"; then                      \
	   echo "${LIBTOOL} --mode=clean rm -f ${FNVECTOR_SERIAL_LIB}" ; \
	   ${LIBTOOL} --mode=clean rm -f ${FNVECTOR_SERIAL_LIB} ;        \
	   echo "rm -f ${FNVECTOR_SERIAL_LIB_FILES}" ;                   \
	   rm -f ${FNVECTOR_SERIAL_LIB_FILES} ;                          \
	   echo "rm -f fnvector_serial.o" ;                              \
	   rm -f fnvector_serial.o ;                                     \
	 fi
	rm -f sundials_config.h

uninstall: clean
	$(LIBTOOL) --mode=uninstall rm -f $(libdir)/$(NVECTOR_SERIAL_LIB)
	rm -f $(includedir)/nvector_serial.h
	@if test "X${FCMIX_ENABLED}" = "Xyes"; then                                    \
	   echo "${LIBTOOL} --mode=uninstall rm -f ${libdir}/${FNVECTOR_SERIAL_LIB}" ; \
	   ${LIBTOOL} --mode=uninstall rm -f ${libdir}/${FNVECTOR_SERIAL_LIB} ;        \
	 fi

nvector_serial.lo: $(srcdir)/nvector_serial.c
	$(LIBTOOL) --mode=compile $(CC) $(CPPFLAGS) -I. -I$(SHARED_INC_DIR) -I$(NVECTOR_SERIAL_INC_DIR) $(CFLAGS) -c $(srcdir)/nvector_serial.c
fnvector_serial.lo: $(srcdir)/fnvector_serial.c
	@if test "X${FCMIX_ENABLED}" = "Xyes"; then                                                                                                          \
	   echo "${LIBTOOL} --mode=compile ${CC} ${CPPFLAGS} -I. -I${SHARED_INC_DIR} -I${NVECTOR_SERIAL_INC_DIR} ${CFLAGS} -c ${srcdir}/fnvector_serial.c" ; \
	   ${LIBTOOL} --mode=compile ${CC} ${CPPFLAGS} -I. -I${SHARED_INC_DIR} -I${NVECTOR_SERIAL_INC_DIR} ${CFLAGS} -c ${srcdir}/fnvector_serial.c ;        \
	 fi

libtool: $(top_builddir)/$(LIBTOOL_DEPS)
	@cd $(top_builddir) ;                 \
	 $(SHELL) ./config.status --recheck ; \
	 cd $(abs_builddir)
